package com.woniu.his.bms.app.apiImpl;

import cn.hutool.core.bean.BeanUtil;
import com.woniu.his.bms.client.BmsQueryAmountForStaffClient;
import com.woniu.his.bms.client.result.QueryAmountForStaffResult;
import com.woniu.his.bms.service.InvoiceRecordService;
import com.woniu.his.bms.service.dto.QueryAmountForStaffDto;
import com.woniu.his.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
@RequestMapping("/bms")
public class BmsQueryAmountForStaffApiImpl implements BmsQueryAmountForStaffClient {

    @Resource
    private InvoiceRecordService invoiceRecordService;

    @Override
    public Result<QueryAmountForStaffResult> QueryAmountForStaff(Long staffId,String date) {

        log.info("查询某个医生的某天的工作量的入参：staffId:{}，date:{}",staffId,date);
        QueryAmountForStaffDto staffDto=invoiceRecordService.queryAmountForStaff(staffId,date);
        QueryAmountForStaffResult result= BeanUtil.copyProperties(staffDto,QueryAmountForStaffResult.class);
        return Result.getInstance(QueryAmountForStaffResult.class).setData(result);
    }
}
